home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / info-service / prospero / PRM / src / testprog / ocean.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-24  |  1.2 KB  |  60 lines

  1. #include <CMMDlib.h>
  2. #include <stdio.h>
  3. #include <errno.h>
  4.  
  5. #ifndef ANY_TAG
  6. #define ANY_TAG -1
  7. #endif
  8.  
  9. #include <comm.h>
  10. extern int errno;
  11.  
  12. /* This is template program for the host */
  13. void
  14. TIO_init_procedure()
  15.  
  16. {
  17.   void Main_Function ();
  18.     int iteractions;
  19.     char buf[20];
  20. #if 0
  21.     if (argc < 2)
  22.        {fprintf (stderr, "Usage: %s\n", argv[0]);
  23.         exit (-1);
  24.        }
  25. #endif
  26.     sleep(4);
  27.     printf("Number of iterations: ");
  28.     if (gets(buf) <= (char *)0) {
  29.       if (errno == EINTR) 
  30.     gets(buf);
  31.     }
  32.     iteractions = atoi (buf);
  33.  
  34. #ifdef CM5
  35.     CMMD_enable ();                /* Initializa CMMD          */ 
  36.     Ocean_Main ();                 /* Start all nodes          */
  37. #endif
  38.  
  39.     CMMD_bc_from_host ((char *) (& iteractions), sizeof (int));
  40.   }
  41.  
  42.  
  43.  
  44. finish()
  45. {
  46.     double time_1, time_2;
  47.  
  48.     CMMD_receive (0, ANY_TAG, &time_1, sizeof (double));
  49.     CMMD_receive (0, ANY_TAG, &time_2, sizeof (double));
  50.     printf ("time_1 = %12.3f, time_2 = %12.3f, time = %12.3f\n", time_1, 
  51.         time_2, time_2-time_1);
  52.  
  53. #ifdef CM5
  54.     CMMD_sync_host_with_nodes ();  /* Wait for nodes to finish */
  55.     CMMD_disable ();               /* Disable CMMD library     */
  56. #endif
  57.  
  58.    }
  59.  
  60.